<template>
  <div class="container">
    <div class="content">
      <div class="top">
        <div class="header">
          <span class="title">开通特约商户</span>
        </div>
        <div class="desc"></div>
      </div>
      <div class="login" style="padding:30px 20px;margin-top:200px;font-size:18px;">
        <div style="text-align:center;">
          <a-button @click="goPage" type="primary">开通特约商户</a-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { message } from "ant-design-vue";
import api from "@/common/api";
import { error } from "util";
import { fail } from "assert";

import AForm from "ant-design-vue/es/form/Form";
import ATabs from "ant-design-vue/es/tabs";
import GlobalFooter from "../../layouts/GlobalFooter";
import AFormItem from "ant-design-vue/es/form/FormItem";
import AInput from "ant-design-vue/es/input/Input";
import AIcon from "ant-design-vue/es/icon";
import AInputGroup from "ant-design-vue/es/input/Group";
import AButton from "ant-design-vue/es/button/button";
import ACol from "ant-design-vue/es/grid/Col";
import ARow from "ant-design-vue/es/grid/Row";
import ACheckbox from "ant-design-vue/es/checkbox/Checkbox";
import AAlert from "ant-design-vue/es/alert/index";

const ATabPane = ATabs.TabPane;

export default {
  name: "Login",
  components: {
    AAlert,
    ACheckbox,
    ACol,
    ARow,
    AButton,
    AInputGroup,
    AIcon,
    AInput,
    AFormItem,
    GlobalFooter,
    ATabPane,
    ATabs,
    AForm
  },
  data() {
    return {
      form: this.$form.createForm(this),
      logging: false,
      error: "",
      status: ""
    };
  },
  mounted() {},
  methods: {
    goPage() {
      // const data = {
      //     memberNo: this.memberNo
      // }
      // 提交成功清缓存
      // const data1 = {};
      // api.Close(
      //   data1,
      //   res => {
      //     console.log("res", res);
      //   },
      //   err => {}
      // );
      const data = "";
      api.GoSpe(
        data,
        res => {
          console.log("res", res);
          if (res.data) {
            if (res.data.logMerchantAddRequest) {
              let infoid = res.data.logMerchantAddRequest.id;
              let num = 190508165706023114;
              console.log(num);
              console.log("infoid", typeof infoid, infoid);
              let useApi = res.data.logMerchantAddRequest.useApi;
              if (useApi) {
                localStorage.setItem("docking", useApi);
              } else {
              }
              if (infoid) {
                localStorage.setItem("infoid", infoid);
              } else {
              }
            } else {
              console.log(res.data.logMerchantAddRequest);
            }
          }
          if (res.message == "入网申请") {
            let product = res.data;
            localStorage.setItem("product", JSON.stringify(product));
            this.$router.push("/SpeCustomer/step1");
          } else if (res.message == "初审不通过" || res.message == "提交失败") {
            this.$router.push({
              path: "/SpeCustomer/step2",
              query: { modify: true }
            });
          } else if (res.message == "初审通过") {
            this.$router.push({
              path: "/SpeCustomer/step5",
              query: { issuc: "true" }
            });
          } else if (res.message == "审核不通过") {
            this.$router.push({
              path: "/SpeCustomer/step5",
              query: { issuc: "false" }
            });
            let recheckResult = res.data.logMerchantAddRequest.remark;
            localStorage.setItem("recheckResult", recheckResult);
          } else if (res.message == "审核通过") {
            this.$router.push("/SpeCustomer/step6");
          } else if (res.message == "没有登陆") {
            this.$message.info("请登录！");
            this.$router.push({ path: "/home" });
          } else {
            console.log(res.code, res.message);
            this.$message.info("审核中！");
          }
        },
        err => {
          console.log("err", err);
        }
      );
    }
  }
};
</script>

<style lang="less" scoped>
.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: auto;
  background: #f0f2f5
    url("https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg")
    no-repeat center 110px;
  background-size: 100%;
  .content {
    padding: 32px 0;
    flex: 1;
    @media (min-width: 768px) {
      padding: 112px 0 24px;
    }
    .top {
      text-align: center;
      .header {
        height: 44px;
        line-height: 44px;
        a {
          text-decoration: none;
        }
        .logo {
          height: 44px;
          vertical-align: top;
          margin-right: 16px;
        }
        .title {
          font-size: 33px;
          color: rgba(0, 0, 0, 0.85);
          font-family: "Myriad Pro", "Helvetica Neue", Arial, Helvetica,
            sans-serif;
          font-weight: 600;
          position: relative;
          top: 2px;
        }
      }
      .desc {
        font-size: 14px;
        color: rgba(0, 0, 0, 0.45);
        margin-top: 12px;
        margin-bottom: 40px;
      }
    }
    .login {
      background-color: #ccc;
      border: 1px solid #ccc;
      border-radius: 20px;
      width: 368px;
      margin: 0 auto;
      @media screen and (max-width: 576px) {
        width: 95%;
      }
      @media screen and (max-width: 320px) {
        .captcha-button {
          font-size: 14px;
        }
      }
      .icon {
        font-size: 24px;
        color: rgba(0, 0, 0, 0.2);
        margin-left: 16px;
        vertical-align: middle;
        cursor: pointer;
        transition: color 0.3s;

        &:hover {
          color: #1890ff;
        }
      }
    }
  }
}
.but-sty {
  width: 120px;
  font-size: 16px;
}
</style>
